package com.spring;

import org.springframework.core.BridgeMethodResolver;

import java.lang.reflect.Method;
import java.lang.reflect.Modifier;

/**
 * @Package: com.spring
 * @ClassName: bridgedMethod
 * @Author: h2cloud
 * @CreateTime: 2023/10/23 11:39 下午
 * @Description:
 */
public class bridgedMethodTest {

	public static void main(String[] args) {
		Method[] methods = C.class.getDeclaredMethods();
		for (Method method : methods) {
			String name = method.getName();
			int modifiers = method.getModifiers();
			boolean aPublic = Modifier.isPublic(modifiers);
			System.out.println("method = " + method);
			System.out.println("method.isBridge() = " + method.isBridge());

			Method bridgedMethod = BridgeMethodResolver.findBridgedMethod(method);
			System.out.println("bridgedMethod = " + bridgedMethod);
			System.out.println("name = " + name + "  aPublic = " + aPublic);
		}
	}

	static class A {
		public void foo() {
		}
	}

	public static class C extends A {

	}

	public static class D extends A {
		public void foo() {
		}
	}
}
